#!/bin/bash

# 员工API测试脚本
# 用于测试分表功能

BASE_URL="http://localhost:8080"

echo "=== 员工API测试脚本 ==="

# 测试添加员工 - 2025年数据
echo "1. 添加2025年员工数据..."
curl -X POST "${BASE_URL}/employee" \
  -H "Content-Type: application/json" \
  -d '{
    "employeeNo": "E2025011",
    "idCard": "440101199201010011",
    "phone": "13800000111",
    "email": "test2025011@example.com",
    "entryDate": "2025-01-15",
    "name": "张三"
  }'

echo -e "\n\n"

# 测试添加员工 - 2026年数据
echo "2. 添加2026年员工数据..."
curl -X POST "${BASE_URL}/employee" \
  -H "Content-Type: application/json" \
  -d '{
    "employeeNo": "E2026016",
    "idCard": "440101199201010016",
    "phone": "13800000116",
    "email": "test2026016@example.com",
    "entryDate": "2026-01-05",
    "name": "孙八"
  }'

echo -e "\n\n"

# 测试查询所有员工
echo "3. 查询所有员工..."
curl -X GET "${BASE_URL}/employee/list"

echo -e "\n\n"

# 测试按年份查询
echo "4. 查询2025年员工..."
curl -X GET "${BASE_URL}/employee/list?entryDateStart=2025-01-01&entryDateEnd=2025-12-31"

echo -e "\n\n"

echo "5. 查询2026年员工..."
curl -X GET "${BASE_URL}/employee/list?entryDateStart=2026-01-01&entryDateEnd=2026-12-31"

echo -e "\n\n=== 测试完成 ===" 